// router/routes.ts
import type { RouteRecordRaw } from "vue-router";
import NotFound from "@/views/404.vue";
import DefaultLayout from "@/layouts/DefaultLayout.vue";
import AuthLayout from "@/layouts/AuthLayout.vue";
import LoginPage from "@/views/Auth/login.vue";
import RegisterPage from "@/views/Auth/register.vue";


export const baseRoutes: RouteRecordRaw[] = [
  {
    path: "/",
    component: DefaultLayout,
    children: [
      {
        path: "/",
        name: "Home",
        component: () => import("@/views/Home/index.vue"),
        meta: {title: '首页', requiresAuth: false, keepAlive: true ,showHeader: true},
      },
      {
        path: "/search",
        name: "Search",
        component: () => import("@/views/Search/index.vue"),
        meta: { title: '搜索', requiresAuth: false, keepAlive: false,showHeader: true },
      },
      {
        path: "/about",
        name: "About",
        component: () => import("@/views/About/index.vue"),
        meta: { title: '关于', requiresAuth: false, keepAlive: false,showHeader: true },
      },
      {
        path: "/products/list",
        name: "ProductList",
        component: () => import("@/views/Product/List.vue"),
        meta: {title: '商品列表', requiresAuth: false ,showHeader: true},
      },
      {
        path: "/product/detail/:id",
        name: "ProductDetail",
        component: () => import("@/views/Product/Detail.vue"),
        meta: {title: '商品详情', requiresAuth: false ,showHeader: false},
      },
      {
        path: "/cart",
        name: "Cart",
        component: () => import("@/views/Cart/index.vue"),
        meta: { title: '购物车', requiresAuth: false,showHeader: false },
      },
      {
        path: "/test/area",
        name: "TestArea",
        component: () => import("@/views/Test/area.vue"),
        meta: { requiresAuth: false,showHeader: true },
      },{
        path: "/test",
        name: "Test",
        component: () => import("@/views/Test/index.vue"),
        meta: { requiresAuth: false,showHeader: true },
      }
    ],
  },
   {
    path: '/auth',
    component: AuthLayout,
    children: [
      { path: 'login', name: 'Login', component: LoginPage },
      { path: 'register', name: 'Register', component: RegisterPage }
    ]
  },
  // 其他路由...
  {
    path: "/:pathMatch(.*)*",
    name: "NotFound",
    component: NotFound,
    meta: { title: "404页面", requiresAuth: false },
  },
];
